﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace HIWSystem.Converters
{
    public class EmptyValueToVisibleConverter : IValueConverter
    {
        //Source-Target
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string val = (value??"").ToString();
            //判断值是不是为空  空隐藏
            if (val == "" || val=="--请选择--")
            {
                return Visibility.Collapsed; 
            }
            else //非空不隐藏
            {
                return Visibility.Visible;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
